/*
 * @Author: wangyingjie 2778809626@qq.com
 * @Date: 2025-11-19 13:45:15
 * @LastEditors: wangyingjie 2778809626@qq.com
 * @LastEditTime: 2025-11-20 14:01:43
 * @FilePath: \VTKModelStudio\SettingPage.h
 * @Description:
 */
#ifndef SettingPage_H
#define SettingPage_H

// #include "core_lib_export.h"

#include <ElaDialog.h>

class VTKModelStudio;
class QSlider;
class QSpinBox;
class QDoubleSpinBox;
class QCheckBox;
class QPushButton;
class QLabel;
class QComboBox;

class SettingPage : public ElaDialog
{
    Q_OBJECT
  public:
    explicit SettingPage(QWidget* parent = nullptr, VTKModelStudio* studio = nullptr);
    ~SettingPage();

    void updateLightPositionDisplay();

  private Q_SLOTS:
    // 相机控制
    void onCameraPositionChanged();
    void onDirectionControl();
    void onResetCamera();

    // 模型外观
    void onModelColorChanged();
    void onModelOpacityChanged(int value);
    void onModelRepresentationChanged(int index);

    // 背景控制
    void onBackgroundColorChanged();
    void onGradientBackgroundChanged(int state);

    // 光照控制
    void onLightEnabledChanged(int state);
    void onLightIntensityChanged(int value);
    void onLightPositionChanged();
    void onLightFocalPointChanged();
    void onResetLightPosition();

    // 坐标轴控制
    void onAxesWorldVisibleChanged(int state);

    // 姿态指示器控制
    void onAttitudeMarkerVisibleChanged(int state);
    void onAttitudeMarkerTypeChanged(int index);
    void onAttitudeMarkerInteractiveChanged(int state);

    // 过滤器
    void onShrinkFilterChanged(int state);
    void onClipFilterChanged(int state);

    // 鼠标交互
    void onMouseInteractionChanged(int state);

  private:
    void setupUI();
    void updateCameraLabels();
    void updateRotationLabels();

  private:
    VTKModelStudio* m_studio;

    // 相机控制
    QDoubleSpinBox* m_cameraPosXSpin;
    QDoubleSpinBox* m_cameraPosYSpin;
    QDoubleSpinBox* m_cameraPosZSpin;
    QSlider* m_yawSlider;
    QSlider* m_pitchSlider;
    QSlider* m_rollSlider;
    QLabel* m_yawLabel;
    QLabel* m_pitchLabel;
    QLabel* m_rollLabel;
    QPushButton* m_resetCameraBtn;

    // 模型外观
    QPushButton* m_modelColorBtn;
    QSlider* m_opacitySlider;
    QLabel* m_opacityLabel;
    QComboBox* m_representationCombo;

    // 背景控制
    QPushButton* m_bgColorBtn;
    QPushButton* m_bgColor2Btn;
    QCheckBox* m_gradientBgCheck;

    // 光照控制
    QCheckBox* m_lightEnabledCheck;
    QSlider* m_lightIntensitySlider;
    QLabel* m_lightIntensityLabel;
    QDoubleSpinBox* m_lightPosXSpin;
    QDoubleSpinBox* m_lightPosYSpin;
    QDoubleSpinBox* m_lightPosZSpin;
    QDoubleSpinBox* m_lightFocalXSpin;
    QDoubleSpinBox* m_lightFocalYSpin;
    QDoubleSpinBox* m_lightFocalZSpin;
    QPushButton* m_resetLightBtn;

    // 坐标轴控制
    QCheckBox* m_axesWorldVisibleCheck;

    // 姿态指示器控制
    QCheckBox* m_orientationMarkerVisibleCheck;
    QComboBox* m_orientationMarkerTypeCombo;
    QCheckBox* m_orientationMarkerInteractiveCheck;

    // 过滤器
    QCheckBox* m_shrinkFilterCheck;
    QCheckBox* m_clipFilterCheck;

    // 鼠标交互
    QCheckBox* m_mouseInteractionCheck;
};

#endif  // SettingPage_H